package org.jsbd.boss.service.impl;


import org.apache.commons.lang.StringUtils;
import org.jsbd.boss.common.redis.RedisClient;
import org.jsbd.boss.dao.ISoContentDao;
import org.jsbd.boss.service.ISoContentService;
import org.jsbd.boss.util.CacheKey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("soContentService")
public class SoContentServiceImpl implements ISoContentService {
	public static final Logger LOGGER = LoggerFactory.getLogger(SoContentServiceImpl.class);

	@Autowired
	private ISoContentDao soContentDao;
	@Autowired
	private RedisClient<String,Object> redisClient;
	
	@Override
	public String getSoContent() {
		String content=(String)redisClient.get(CacheKey.FILE_SO_CONTENT_KEY);
		if(content==null) {
			content=soContentDao.getSoContent();
			if(content==null) {
				content="";
			}
			redisClient.put(CacheKey.FILE_SO_CONTENT_KEY, content,60*15);
		}
		return content;
	}
}
